#define F_CPU 20000000UL	      // Sets up the default speed for delay.h
void wait1ms(void);

// Include definition file
#include <ioavr.h>
#include <inavr.h>

int main( void )
{
  
  DDRD = 255;	
  PORTD = 255;
  
    while (1)
  {
    for (int i=0; i<500 ; i++) {wait1ms();}
    PORTD=~PORTD;
  }
}

// *** Primitive wait() function ***
void wait1ms(void){
  __delay_cycles(F_CPU/1000);
}
